import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "library",
      component: () => import("@/App.vue"),
      children: [
        {
          path: "/",
          name: "welcome",
          component: () => import("@/views/Welcome.vue"),
        },
        {
          path: "/login",
          name: "login",
          component: () => import("@/views/Login.vue"),
        }
      ]
    },
    {
      path: "/user",
      name: "User",
      component: () => import("@/views/UserIndex.vue"),
      children: [
        {
          path: "/user/index",
          name: "userIndex",
          component: () => import("@/components/User/Index.vue"),
        },
        {
          path: "/user/book",
          name: "userBook",
          component: () => import("@/components/User/Book.vue"),
        },
        {
          path: "/user/borrow",
          name: "userBorrow",
          component: () => import("@/components/User/Borrow.vue"),
        },
        {
          path: "/user/info",
          name: "userInfo",
          component: () => import("@/components/User/Info.vue"),
        },
        {
          path: "/user/notice",
          name: "UserNotice",
          component: () => import("@/components/Notice.vue"),
        },
        {
          path : '/user/message',
          name : 'UserMessage',
          component : () => import('@/components/User/Message.vue')
        }
      ],
    },
    {
      path: "/admin/index",
      name: "admin",
      component: () => import("@/views/AdminIndex.vue"),
      children: [
        {
          path: "/admin/index",
          name: "adminIndex",
          component: () => import("@/components/Admin/Index.vue"),
        },
        {
          path: "/admin/book",
          name: "adminBook",
          component: () => import("@/components/Admin/Book.vue"),
        },
        {
          path: "/admin/borrow",
          name: "borrowBook",
          component: () => import("@/components/Admin/Borrow.vue"),
        },
        {
          path: "/admin/return",
          name: "returnBook",
          component: () => import("@/components/Admin/Return.vue"),
        },
        {
          path: "/admin/userinfo",
          name: "adminInfo",
          component: () => import("@/components/Admin/Users.vue"),
        },
        {
          path: "/admin/borrowTable",
          name: "borrowTable",
          component: () => import("@/components/Admin/BorrowTable.vue"),
        },
        {
          path: "/admin/notice",
          name: "AdminNotice",
          component: () => import("@/components/Admin/Notice.vue"),
        },
        {
          path: "/admin/admins",
          name: "AdminsManage",
          component: () => import("@/components/Admin/Admins.vue"),
        },
        {
          path: "/admin/system",
          name: "SystemManage",
          component: () => import("@/components/Admin/System.vue"),
        },
      ],
    },
  ]
})

export default router;
